﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Diet;

namespace Logic
{
    public class calorificFactory
    {
        public static Carrot CreateCarrot()
        {
            Carrot carrot = new Carrot();
            carrot.Price = 13;
            carrot.Calorific_value = 21;
            return carrot;
        }

        public static Tomato CreateTomato()
        {
            Tomato tomato = new Tomato();
            tomato.Price = 108;
            tomato.Calorific_value = 50;
            return tomato;
        }
        
        public static int PotaloCalory(int count)
        {
            Potatoes potato = new Potatoes();
            potato.Price = 13;
            potato.Calorific_value = 30;
            return potato.Calorific_value * count;
        }
        public static int CarrotCalory (int count)
        {
            Carrot carrot = new Carrot();
            carrot.Price = 13;
            carrot.Calorific_value = 21;
            return carrot.Calorific_value * count;
        }
        public static int OnionCalory (int count)
        {
            Onion onion = new Onion();
            onion.Price = 13;
            onion.Calorific_value = 17;
            return onion.Calorific_value * count;
        }
        public static int TomatoCalory (int count)
        {
            Tomato tomato = new Tomato();
            tomato.Price = 108;
            tomato.Calorific_value = 50;
            return tomato.Calorific_value * count;
        }
        public static Potatoes CreatePotato()
        {
            Potatoes potato = new Potatoes();
            potato = new Potatoes();
            potato.Price = 13;
            potato.Calorific_value = 17;
            return potato;
        }
        public static Onion CreateOnion()
        {
            Onion onion = new Onion();
            onion = new Onion();
            onion.Price = 13;
            onion.Calorific_value = 17;
            return onion;
        }
        public static Salad CreateSalad(int Ocount, int Pcount, int Ccount, int Tcount)
        {
            Salad salad = new Salad();
            Carrot[] carrot = new Carrot[Ccount];
            Potatoes[] potato = new Potatoes[Pcount];
            Onion[] onion = new Onion[Ocount];
            Tomato[] tomato = new Tomato[Tcount];
            for (int i = 0; i < Ccount; i++)
            {
                carrot[i] = CreateCarrot();
                salad.AddVegetable(carrot[i]);
            }
            for (int i = 0; i < Pcount; i++)
            {
                potato[i] = CreatePotato();
                salad.AddVegetable(potato[i]);
            }
            for (int i = 0; i < Ocount; i++)
            {
                onion[i] = CreateOnion();
                salad.AddVegetable(onion[i]);
            }
            for (int i = 0; i < Tcount; i++)
            {
                tomato[i] = CreateTomato();
                salad.AddVegetable(tomato[i]);
            }
 
            return salad;
        }
    }
}
